﻿using System;

namespace TeamDraft
{
    public class DraftEvent
    {
        private DateTime m_date = DateTime.MinValue;
        private DraftStyle m_style = DraftStyle.Regular;
        private DraftType m_type = DraftType.Default;
        private String m_location = null;
        private int m_roundcount = 0;
        private int m_teamcount = 0;
        private String m_title = null;
        private String m_subtitle = null;

        //#MS Eventually we can add code that would cover things like length of time allowed for a pick or other stuff unique to a draft.

        public DraftEvent()
        {
            Initialize();
        }
        
        /// <param name="teams">Count of Teams in Draft</param>
        /// <param name="rounds">Count of Rounds in Draft</param>
        public DraftEvent(Byte teams, Byte rounds)
        {
            m_teamcount = teams;
            m_roundcount = rounds;
            Initialize();
        }

        /// <param name="type">Type of Draft Event</param>
        public DraftEvent(DraftType type)
        {
            m_type = type;
            Initialize();
        }

        //#ms eventually we can add a initialization routine that will load values from a file.  but then we would have to add additional properties for file location and name.

        /// <summary>
        /// Location of the Draft
        /// </summary>
        /// <remarks>
        /// Town, State, Building, some indication of physical location of the draft that is pertinent for the draft.
        /// This may become another class that adds the ability to include address, city, zip code etc.  But for now, simple string text.
        /// </remarks>
        /// <value>String</value>
        public String Location
        {
            get
            {
                return m_location;
            }
            set
            {
                m_location = value;
            }
        }

        /// <summary>
        /// Date and Time of the Draft
        /// </summary>
        /// <remarks>Will default to current date and time when created.</remarks>
        /// <value>DateTime</value>
        public DateTime Date
        {
            get
            {
                return m_date;
            }
            set
            {
                m_date = value;
            }
        }

        /// <summary>
        /// Number of Teams in the Draft.
        /// </summary>
        /// <remarks>
        /// Valid range 1 to 255
        /// </remarks>
        /// <value>Byte</value>
        public int TeamCount
        {
            get
            {
                return m_teamcount;
            }
            set
            {
                m_teamcount = value;
            }
        }

        /// <summary>
        /// Number of Rounds in the Draft
        /// </summary>
        /// <remarks>
        /// Valid range 1 to 255
        /// </remarks>
        /// <value>Byte</value>
        public int RoundCount
        {
            get
            {
                return m_roundcount;
            }
            set
            {
                m_roundcount = value;
            }
        }

        /// <summary>
        /// Style of Draft
        /// </summary>
        /// <remarks>
        /// Regular (Same order every round)
        /// Snake (Regular order on odd rounds, reverse order on even rounds)
        /// Other (To be defined)
        /// </remarks>
        /// <value>DraftStyle</value>
        public DraftStyle Style
        {
            get
            {
                return m_style;
            }
            set
            {
                m_style = value;
            }
        }

        /// <summary>
        /// Name of Event
        /// </summary>
        /// <remarks>Western Regional.  Default Tournament.  Leattle League etc.</remarks>
        /// <value>String</value>
        public String Title
        {
            get
            {
                return m_title;
            }
            set
            {
                m_title = value;
            }
        }

        /// <summary>
        /// Type of Event
        /// </summary>
        /// <remarks>Baseball, Football, Strat-O-Matic, Office League, Fantasy</remarks>
        /// <value>String</value>
        public String Subtitle
        {
            get
            {
                return m_subtitle;
            }
            set
            {
                m_subtitle = value;
            }
        }

        /// <summary>
        /// Type of Event
        /// </summary>
        /// <remarks>This will preset draft event to known quantities for a known draft.  Currently only default and strat is supported, but this can change.</remarks>
        /// <value>DraftType</value>
        public DraftType Type
        {
            get
            {
                return m_type;
            }
            set
            {
                m_type = value;
            }
        }

        /// <summary>
        /// Initialize Class Variables
        /// </summary>
        private void Initialize()
        {
            switch (m_type)
            {
                case DraftType.StarTournament:
                    if (DateTime.MinValue == m_date) m_date = DateTime.Today;
                    if (null == m_location) m_location = "USA";
                    if (null == m_title) m_title = "Strat-O-Matic Baseball";
                    if (null == m_subtitle) m_subtitle = "Star Tournament";
                    if (Byte.MinValue == m_roundcount) m_roundcount = 26;
                    if (Byte.MinValue == m_teamcount) m_teamcount = 8;
                    m_style = DraftStyle.Snake;
                    break;
                default:
                    if (DateTime.MinValue == m_date) m_date = DateTime.Today;
                    if (null == m_location) m_location = "Somewhere, World";
                    if (null == m_title) m_title = "Game";
                    if (null == m_subtitle) m_subtitle = "Tournament";
                    if (Byte.MinValue == m_roundcount) m_roundcount = 10;
                    if (Byte.MinValue == m_teamcount) m_teamcount = 12;
                    m_style = DraftStyle.Regular;
                    break;

            }
            
        }
    }
}
